<div id="form"></div>
<script>
var frm=$("#form").ajajform({
	header: null,
	footerButtons: [
		{value: "{{!button_create}}",url: "{{action}}?mode=edit"}
	]
});
var grid=frm.ajajform("insertWidget",null,null,{
	type: "grid",
	title: "{{!title}}",
	name: "templates",
	rowClasses: [{
		name:"template",
		columns: [
			{name: "name", label: "{{!col_name}}", width: 400, url: '{{action}}?mode=edit&template_id='},
			{name: "places_cnt", label: "{{!col_places_count}}", width: 100},
			{name: "pages_cnt", label: "{{!col_pages_count}}", width: 100},
			{name: "delete_link", label: ".", width: 100, url: '{{action}}?mode=delete&template_id='}
		]
	}]
});
var templates={{JSON:templates}};
for (var i=0;i<templates.length;i++) {
	var tmpl=templates[i];
	grid.ajajform_grid("insertRow",null,{rowClass: "template",cells:[tmpl.name,tmpl.places_cnt,tmpl.pages_cnt,'{{!link_delete}}'],id:tmpl.id});
}
</script>

